// Counter controlled error-recovery loop
import java.util.Scanner;

public class MultiplicationHelper{
   public static void main(String[] args){
      int num1, num2, response, count = 0;
      Scanner kbScanner = new Scanner(System.in);
      System.out.printf("Enter two integers: ");
      num1 = kbScanner.nextInt();
      num2 = kbScanner.nextInt();

      System.out.printf("What is %d * %d? ", num1, num2);

      do{
          response = kbScanner.nextInt();
          count++;
          if((response != num1 * num2) && (count < 3))
                System.out.println("Wrong response. Please try again.");
      } while((response != num1 * num2) && (count < 3 ));

      if(response != num1 * num2)
         System.out.println("Sorry ! You were not successful.");
      else
         System.out.println("Congratulations !  You got the correct answer.");
   }
}